<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
  $fileName = $_POST['fileName'];
  $userId = $_POST['userId'];
  $param = $_POST['param'];

  if (!file_exists($fileName)) {
    echo "已跑路";
    return;
  }

  $fileContent = file_get_contents($fileName);
  $data = json_decode($fileContent, true);

  $output = array();

  $output['title'] = $data['title'];

  if ($data['Switch'] === "true") {
      $output['注册机'] = "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b";
  } else {
      $output['注册机'] = "fcbcf165908dd18a9e49f7ff27810176db8e9f63b4352213741664245224f8aa";
  }

  $output['data'] = $data['data'];

  if (isset($data['bwnc'][$userId])) {
    // 获取对应的键值
    $expectedValue = $data['bwnc'][$userId];

    $hash = hash('sha256', $expectedValue);
    $output['念程'] = $hash;
  } else {
    $output['念程'] = "ed75d9b94d2de385f259e15ff1a8b9383bbf96c98baadb12a313d3d8f3856cc4";
  }

  header('Content-Type: application/json');
  echo json_encode($output);
}
?>